package com.neusoft.lohas.modules.ivm.entity.business;

import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.neusoft.lohas.common.persistence.IdEntity;
import com.neusoft.lohas.modules.ivm.entity.merchant.Merchant;
/**
 * 商圈滚屏类
 * @author jackie.liu
 * @version 2015-01-29
 */
@Entity
@Table(name = "ivm_business_rollscreen")
@DynamicInsert
@DynamicUpdate
public class RollScreen extends IdEntity<RollScreen> {

	private static final long serialVersionUID = 1L;
	private String title; //
	private Merchant merchant; // 商户信息
	private String logoUrl; // 滚屏图片地址
	private String webUrl; //链接地址
	private String status; // 滚屏状态：0正常，1取消
	private int sort; // 排序号

	public RollScreen() {
		super();
		this.sort = 30;
	}

	public RollScreen(String id) {
		this();
		this.id = id;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	@ManyToOne
	@JoinColumn(name="merchant_id")
	@NotFound(action = NotFoundAction.IGNORE)
	@JsonIgnore
	@NotNull(message="所属商户信息不能为空")
	public Merchant getMerchant() {
		return merchant;
	}

	public void setMerchant(Merchant merchant) {
		this.merchant = merchant;
	}

	public String getLogoUrl() {
		return logoUrl;
	}

	public void setLogoUrl(String logoUrl) {
		this.logoUrl = logoUrl;
	}

	public String getWebUrl() {
		return webUrl;
	}

	public void setWebUrl(String webUrl) {
		this.webUrl = webUrl;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public int getSort() {
		return sort;
	}

	public void setSort(int sort) {
		this.sort = sort;
	}
	
	// 正常/取消
	public static final String OK = "0";
	public static final String NOTOK = "1";

}
